package com.burgeon.backend.EnterpriseWeChat.controller;

import com.burgeon.backend.SHOPBACKEND.entity.recored.MessageRecore;
import com.burgeon.backend.SHOPBACKEND.service.RecordService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("ewapp/record")
public class EWRecordController extends EWBaseController{
    @Autowired
    private RecordService recordService;

    /**
     * 获取消息纪录
     * @param daoId
     * @param openId
     * @return
     */
    @RequestMapping("getRecord")
    public ResponseResult<List<MessageRecore>> getRecord(String daoId, String openId, int page,String token){

        List<MessageRecore> data = recordService.getRecord(daoId,openId,page,token);

        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 是否超过48小时
     * @param openId
     * @return
     */
    @RequestMapping("IsTimeOut")
    public ResponseResult<Boolean> getLastRecord(String openId) {

        Boolean data = recordService.getLastRecord(openId);

        return new ResponseResult<>(SUCCESS,data);
    }
}
